<?php
 $manager = new \MongoDB\Driver\Manager("mongodb://10.0.18.2:27017");
//
//// 插入数据
//        $bulk = new \MongoDB\Driver\BulkWrite;
//        $bulk->insert(['type' => 'wechat', 'data'=>'baidu']);
//        $manager->executeBulkWrite('repulims.news', $bulk);
//        $filter = ['type' => ['$eq' => 'wechat']];
//        $options = [
//            'projection' => ['_id' => 0],
//            'sort' => ['x' => -1],
//        ];
//        $query = new \MongoDB\Driver\Query($filter, $options);
//        $cursor = $manager->executeQuery('repulims.news', $query);
////        $collection = (new \MongoDB\Client)->test->users;
////        $id         = new \MongoDB\BSON\ObjectId('5cecd708ab4e4536fc0076e2');
////        $document   = $collection->findOne(['_id' => $id]);
////        var_dump($document);
//
////        $collection =   $manager->test->site;
////        $id         = new \MongoDB\BSON\ObjectId('61d68c429b17e331fc007401');
////        $document   = $collection->findOne(['_id' => $id]);
//        foreach ($cursor as $document) {
//            print_r($document);
//        }
//        die();
//
//        $table_name='news';
//        $data_all=array('11');
////        $data_all= json_encode(    $data_all);
$newMongodbController =new     MongodbController;
//        $res=$newMongodbController->insert($table_name, $data_all);
//        //var_dump($res);
//        $res = "{\"_id\" : ObjectId(\"61d679d49b17e331fc0073dc\")";
//        $array = ["id"=>"61d6833b9b17e331fc0073ee"];
////            "id" => "61d6833b9b17e331fc0073ee"
////        );

$filter = ['0' => ['$eq' => 'ObjectId("61d6833b9b17e331fc0073ee")']];
$res2=$newMongodbController->select('news',$filter);
var_dump($res2);
?>